From 6d23cb2bd0c027ed562ece6a9ead8c9a5cfbcb47 Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Sun, 3 May 2020 16:54:05 +0000
Subject: [PATCH 11/14] HACK: drm/rockchip: vop: limit resolution to 3840x2160

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 8c9dfeac1..dd5438e7b 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1049,6 +1049,12 @@ static enum drm_mode_status vop_crtc_mode_valid(struct drm_crtc *crtc,
 	long rounded_rate;
 	long lowest, highest;
 
+	if (mode->hdisplay > 3840)
+		return MODE_VIRTUAL_X;
+
+	if (mode->vdisplay > 2160)
+		return MODE_VIRTUAL_Y;
+
 	rounded_rate = clk_round_rate(vop->dclk, mode->clock * 1000 + 999);
 	if (rounded_rate < 0)
 		return MODE_NOCLOCK;
-- 
2.26.2

